﻿<Page x:Class="WpfPostgresql.SkladPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      mc:Ignorable="d" 
      d:DesignHeight="300" d:DesignWidth="300"
	Title="SkladPage">

    <Grid>
        <StackPanel Orientation="Horizontal">
            <StackPanel>
                <StackPanel Orientation="Horizontal" Width="300">
                    <TextBox Text="{Binding NewTovar.Name}" Width="120"/>
                    <TextBox Text="{Binding NewTovar.N}" Width="120"/>
                    <Button Content="Add" Width="60" HorizontalAlignment="Right" Command="{Binding AddCommand}" />
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="Название" Width="110"/>
                    <TextBlock Text="Количество" Width="110"/>
                </StackPanel>
                <ListBox ItemsSource="{Binding Tovars}">                    
                    <ListBox.ItemTemplate>                        
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal" Width="335">
                                <Border BorderBrush="Black" SnapsToDevicePixels="True" BorderThickness="1">
                                    <TextBlock Text="{Binding Name}" Width="110"/>
                                </Border>
                                <Border BorderBrush="Black" SnapsToDevicePixels="True" BorderThickness="1">
                                    <TextBlock Text="{Binding N}" Width="110"/>
                                </Border>
                                <Button Content="+" Command="{Binding ParentVm.AddColCommand}" CommandParameter="{Binding}" Width="25" HorizontalAlignment="Right"/>
                                <TextBox Name="col" Text="{Binding AddedN, Mode=TwoWay}" HorizontalAlignment="Right" Width="35" />
                                <Button Content="x" Width="25" HorizontalAlignment="Right" Command="{Binding ParentVm.DelCommand}" CommandParameter="{Binding}"/>
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>

            </StackPanel>
        </StackPanel>
    </Grid>
</Page>
